layui动态添加删除表格的行元素
$(function () {
let form = layui.form
,laydate = layui.laydate,
laypage = layui.laypage,
layer = layui.layer,
table = layui.table;
//常规用法
laydate.render({
elem: '#test1'
});
laydate.render({
elem: '#test2'
}); let i=1,j=1,k=1;
$('.add-btn').click(function () {
i ;
addstrs1(i);
form.render();
});
$('body').on("click",".btn-del",function () {
var pre = $(this);
layer.confirm('确定要删除么?',{
btn:['确定','取消']
},function () {
$(pre).parent().parent().remove();
layer.closeAll('dialog');
})
//
});
function getRandomNum() {
return parseInt(Math.random()*50);
}
function addstrs1(i) {
let iNums = getRandomNum();
let strs1;
strs1 = '<tr>\n'
评论